home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvglue10.arc / TVWREAD.C < prev    next >
C/C++ Source or Header  |  1988-08-13  |  1KB  |  40 lines

  1. /*================================================*/
  2. /* TVWREAD.C                                      */
  3. /*                                                */
  4. /* (c) Copyright 1988 Ralf Brown                  */
  5. /*     All Rights Reserved                        */
  6. /* May be freely copied for noncommercial use as  */
  7. /* long as this copyright notice is kept intact   */
  8. /* and any changes are indicated in the comment   */
  9. /* blocks for the functions                       */
  10. /*================================================*/
  11.  
  12. #include <stdio.h>
  13. #include "tvapi.h"
  14.  
  15. /*================================================*/
  16. /* TVwin_read  read rest of current line from win */
  17. /*   Ralf Brown 4/3/88                            */
  18. /*================================================*/
  19.  
  20. int pascal TVwin_read(OBJECT win,void *buffer,int maxsize)
  21. {
  22.    PARMLIST2 p ;
  23.    register int count ;
  24.  
  25.    if (buffer == NULL)
  26.       return 0 ;
  27.    p.num_args = 0 ;
  28.    TVsendmsg(READ_MSG, win?TOS:ME, win, (PARMLIST *)&p) ;
  29.    count = (int) p.arg[1] ;
  30.    maxsize-- ;  /* reserve space for null to terminate string */
  31.    if (count > maxsize)
  32.       count = maxsize ;
  33.    while (count--)
  34.       *((char *)buffer)++ = *((char far *)p.arg[0])++ ;
  35.    *((char *)buffer) = '\0' ;
  36.    return (int) p.arg[1] ;
  37. }
  38.  
  39. /* End of TVWREAD.C */
  40.